package org.akomantoso.core.io.util.group;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import org.akomantoso.core.data.Article;
import org.akomantoso.core.data.Chapter;
import org.akomantoso.core.data.Clause;
import org.akomantoso.core.data.Paragraph;
import org.akomantoso.core.data.Part;
import org.akomantoso.core.data.Point;
import org.akomantoso.core.data.Section;
import org.akomantoso.core.data.SubChapter;
import org.akomantoso.core.data.SubParagraph;
import org.akomantoso.core.data.SubSection;
import org.akomantoso.core.data.group.ANhier;
import org.akomantoso.core.io.util.Instantiator;

/**
 * @author <a href="mailto:jacques.militello@gmail.com">Jacques Militello</a>
 */
public final class ANhierGroup {

	private ANhierGroup() {
	}

	public static final Map<String, Instantiator<ANhier>> MAP;

	static {

		Map<String, Instantiator<ANhier>> temp = new HashMap<String, Instantiator<ANhier>>();

		// paragraph
		temp.put(Paragraph.ELEMENT, new Instantiator<ANhier>() {
			public Paragraph instantiate() {
				return new Paragraph();
			}
		});

		// section
		temp.put(Section.ELEMENT, new Instantiator<ANhier>() {
			public Section instantiate() {
				return new Section();
			}
		});

		// subsection
		temp.put(SubSection.ELEMENT, new Instantiator<ANhier>() {
			public SubSection instantiate() {
				return new SubSection();
			}
		});

		// part
		temp.put(Part.ELEMENT, new Instantiator<ANhier>() {
			public Part instantiate() {
				return new Part();
			}
		});

		// chapter
		temp.put(Chapter.ELEMENT, new Instantiator<ANhier>() {
			public Chapter instantiate() {
				return new Chapter();
			}
		});

		// subchapter
		temp.put(SubChapter.ELEMENT, new Instantiator<ANhier>() {
			public SubChapter instantiate() {
				return new SubChapter();
			}
		});

		// subparagraph
		temp.put(SubParagraph.ELEMENT, new Instantiator<ANhier>() {
			public SubParagraph instantiate() {
				return new SubParagraph();
			}
		});

		// article
		temp.put(Article.ELEMENT, new Instantiator<ANhier>() {
			public Article instantiate() {
				return new Article();
			}
		});

		// point
		temp.put(Point.ELEMENT, new Instantiator<ANhier>() {
			public Point instantiate() {
				return new Point();
			}
		});
		
		// clase
		temp.put(Clause.ELEMENT, new Instantiator<ANhier>() {
			public Clause instantiate() {
				return new Clause();
			}
		});

		MAP = Collections.unmodifiableMap(temp);
	}

}